(function(cdt) {
	var log = true
	cdt.util.log = function(message,level){
		if(log){
			if (typeof console != "undefined" && typeof console.debug != "undefined") {
				if(!level){
					console.info(message)
				} else {
					console[level](message)
				}
			}
		}
	}
	cdt.util.dump = function(object){
		if(log){
			if (typeof console != "undefined" && typeof console.debug != "undefined") {
				console.log(object)
			}
		}
	}
	cdt.util.getTime = function(){
		return new Date().valueOf()
	}
	cdt.util.getRandomStr = function(length){
		var str = String(new Date().getTime()).replace(/\D/gi,'')
		if(length){
			str = str.substring(0,length*1.0)
		}
		return str
	}
	cdt.util.rand = function(l,u){
	    return Math.floor((Math.random() * (u-l+1))+l);
	}
	cdt.util.colorFade = function(h1, h2, p) { 
		return ((h1>>16)+((h2>>16)-(h1>>16))*p)<<16|(h1>>8&0xFF)+((h2>>8&0xFF)-(h1>>8&0xFF))*p<<8|(h1&0xFF)+((h2&0xFF)-(h1&0xFF))*p; 
	}
	cdt.util.getRGBFromHex = function(index,hex){
		if(index.toLowerCase() == "r"){
			return parseInt((cdt.util.cutHex(hex)).substring(0,2),16)
		} else if(index.toLowerCase() == "g"){
			return parseInt((cdt.util.cutHex(hex)).substring(2,4),16)
		} else if(index.toLowerCase() == "b"){
			return parseInt((cdt.util.cutHex(hex)).substring(4,6),16)
		}
	}
	cdt.util.cutHex = function(h){
		return (h.charAt(0)=="#") ? h.substring(1,7):h
	}
	cdt.util.flush = function(object){
		if (typeof object != "undefined") {
			delete object
		}
	}
	cdt.util.removeSpaces = function(str){
		str = str + ""
		var newStr = str.replace(/ /g,"")
		return newStr + ""
	}
})(cdt);